package api

import (
	"giftsend/api/handler"
	"giftsend/pkg"
	"github.com/gin-gonic/gin"
)

func LoadRouter(router *gin.Engine) {

	user := router.Group("/api")
	{
		user.POST("/register", handler.Register)
		user.POST("/login", handler.Login)

	}
	zbj := router.Group("/api")
	{
		pkg.JWTAuth("lx")
		zbj.POST("/zbj/create", handler.Create)
		zbj.POST("/zbj/update", handler.Update)
		zbj.POST("/zbj/delete", handler.Delete)
		zbj.POST("/zbj/show", handler.Show)
	}
	comments := router.Group("/api")
	{
		pkg.JWTAuth("lx")
		comments.POST("/comments/create", handler.CommentCreate)
		comments.POST("/comments/update", handler.CommentUpdate)
		comments.POST("/comments/delete", handler.CommentDelete)
		comments.POST("/comments/show", handler.CommentShow)
	}
	Gift := router.Group("/api")
	{
		pkg.JWTAuth("lx")
		Gift.POST("/gift/show", handler.GiftShow)
		Gift.POST("/gift/detail", handler.Giftdetail)
		Gift.POST("/gift/update", handler.GiftUpdate)
		Gift.POST("/gift/delete", handler.GiftDelete)
	}
	router.Run(":8080")
}
